package com.xrz.sxm.aj.activity;

import android.widget.TextView;

import com.xrz.sxm.aj.base.BaseAct;
import com.xrz.sxm.aj.entity.ChartData;
import com.xrz.sxm.aj.entity.SerializableMap;

import java.util.ArrayList;
import java.util.List;

public class Act_ChartDetail extends BaseAct {
    private TextView mTextView;
    private List<ChartData> datas = new ArrayList<ChartData>();
    private int index=0;
    private String[] names, contents;
    private SerializableMap tmpmap;
    @Override
    protected int setView() {
        return R.layout.act__chart_detail;
    }

    @Override
    protected void init() {
        mTextView = (TextView) findViewById(R.id.tv);
        initData();
        index=getIntent().getIntExtra("index",0);
        tmpmap = (SerializableMap) getIntent().getSerializableExtra("data");
        mTextView.setText(datas.get(index).getContent());
    }

    private void initData() {
        names = getResources().getStringArray(R.array.zhengzhuangname);
        contents = getResources().getStringArray(R.array.tiaolifangfa);
        ChartData data;
        for (int i = 0; i < names.length; i++) {
            data = new ChartData();
            data.setIndex(i);
            data.setName(names[i]);
            data.setContent(contents[i]);
            datas.add(data);
        }
    }

    @Override
    protected String setTopTitle() {
        names = getResources().getStringArray(R.array.zhengzhuangname);
        index=getIntent().getIntExtra("index",0);
        return names[index];
    }

    @Override
    protected boolean isBackBtnClickFinish() {
        return true;
    }
}
